From f423003436197a52b9a5af304af024bacd675f09 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 20 Jun 2007 13:38:22 +0100 Subject: [PATCH] 32-on-64: Fix error path from memory_op() hypercall. Signed-off-by: Keir Fraser --- xen/common/compat/memory.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 53628d7a35..5596c5d73a 100644 --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -258,7 +258,8 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat) compat_pfn_t pfn = nat.rsrv->extent_start.p[start_extent]; BUG_ON(pfn != nat.rsrv->extent_start.p[start_extent]); - if ( __copy_to_compat_offset(cmp.rsrv.extent_start, start_extent, &pfn, 1) ) + if ( __copy_to_compat_offset(cmp.rsrv.extent_start, + start_extent, &pfn, 1) ) { if ( split >= 0 ) { @@ -275,6 +276,10 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat) break; } } + + /* Bail if there was an error. */ + if ( (split >= 0) && (end_extent != nat.rsrv->nr_extents) ) + split = 0; } else start_extent = end_extent; -- 2.30.2